import {
  post
} from '../utils/http'
import env from '../config/env'
import {
  Base64
} from 'js-base64';

export function getToken(params) {
  const encode = Base64.encode(`${env.CLIENT_ID}:${env.CLIENT_SECRET}`)
  const authHeader = {
    Authorization: `Basic ${encode}`
  }
  return post(`${env.API_URL}/auth/oauth2/token`, params, authHeader)
}